const isDev = process.env.NODE_ENV !== "production";
const webpack = require("webpack");
const path = require("path");
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
//   .BundleAnalyzerPlugin;
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  pages: {
    index: {
      // 页面入口
      entry: "examples/main.js",
      // 模板来源
      template: "pubilc/index.html",
      // 输出文件名
      filename: "index.html"
    }
  },
  productionSourceMap: false,
  configureWebpack: {
    resolve: {
      alias: {
        "@": resolve("src"),
        "@packages": resolve("packages"),
        "@utils": resolve("packages/utils")
      }
    },
    devtool: isDev ? "source-map" : false,
    plugins: [
      // new BundleAnalyzerPlugin(),
      new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
    ]
  },
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          "primary-color": "#1890ff",
          "link-color": "#1890ff",
          "border-radius-base": "4px"
        },
        javascriptEnabled: true
      }
    }
  }
};
